/*
 */
package tch.code.period.main;

/**
 *
 * @author tch
 */
public class VisitorTest {

    public static void main(String[] args) {
        SimpleVisitor visitor = new SimpleVisitor();

        Car someCar = new Car() {

            @Override
            public void go() {
                throw new UnsupportedOperationException("Not supported yet.");
            }

            @Override
            public void accept(Visitor visitor) {
                visitor.visit(this);
            }
        };

        someCar.accept(visitor);

        Car ferrari = getFerrari();
        Car citroen = new Citroen();
        Car fiat = new Fiat();
        
        ferrari.accept(visitor);
        citroen.accept(visitor);
        fiat.accept(visitor);
        
        Dealer dealer = new Dealer();
        dealer.setSomeCar(ferrari);
        dealer.sellCar(visitor);
    }
    
    private static Car getFerrari() {
        return new Ferrari();
    }
}
